/* 
 * File:   disk.h
 * Author: Chen Liu     
 * Student number: 3996591
 *
 * Created on October 22, 2012, 2:19 AM
 */

#ifndef DISK_H
#define	DISK_H

enum AlgType {
    eFCFS, eSSTF, eSCAN, eCSCAN, eLOOK, eCLOOK
};

class DiskScheduler {
public:
    DiskScheduler(int NumTracks, int HdSpeed, int *RefString, int N);
    double AccessDisk(AlgType Alg, int TrackRequestsPerSec);
private:
    double FCFS();
    double SSTF();
    double SCAN();
    double CSCAN();
    double LOOK();
    double CLOOK();
    
    int GetReq(int *reqlist, double dSeekTimes);
    void Sort(int *reqlist, int length);
    int GetMin(int *reqlist, int length);
    int GetNext(int *reqlist, int length, int current);   
    int GetPre(int *reqlist, int length, int current);  

    int hspeed; //head speed
    int numt; //number of track
    int numrs; //number of reference string;
    int reqpsec; //number of track requests/second;
    int *refs; //reference string
    double *reqt; // request time, remember arrival time ms
    int *point;
};

#endif	/* DISK_H */

